package com.guochenglang.www.dao;

import com.guochenglang.www.pojo.CollectArticle;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author GuoChenglang
 */
public interface CollectArticleDao {
    /**
     * 获得收藏的文章
     *
     * @param collectArticle 收藏者id
     * @return 文章列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<CollectArticle> collectArticleSelect(CollectArticle collectArticle) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 收藏的知识库列表
     *
     * @param page       当前页面
     * @param num        一页显示的个数
     * @param conditions 搜素条件
     * @param order      排列依据
     * @param mode       升序还是降序
     * @return 文章列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<CollectArticle> collectArticleSelectByLimit(int page, int num, CollectArticle conditions, String order, String mode) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 收藏知识库
     *
     * @param collectArticle 收藏的知识库id信息
     * @return 收藏的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int insertCollectArticle(CollectArticle collectArticle) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 取消收藏
     *
     * @param collectArticle 取消的条件
     * @return 取消行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int deleteCollectArticle(CollectArticle collectArticle) throws SQLException, InterruptedException, IllegalAccessException;

}

